function album_scroll(option){
	var that = this;
	that.obj = $(option.obj);
	that.btn_prev = that.obj.find(option.btn_prev);
	that.btn_next = that.obj.find(option.btn_next);
	that.list = that.obj.find(option.album_list);
	that.step = option.step;
	that.len = option.len;
	that.area = option.area;
	that.animateing = false;
	that.curIdx = 0;
	function init(){
		that.list.css({
			//"width":that.step * that.len,
			"width":"100%",
			"left":0
		});
		that.btnShow();
	}
	init();
	that.btn_next.bind({
		click : function(){
			if(!that.animateing){
				that.animateing = true;
				that.curIdx++;
				that.scrollTo(that.curIdx);
			}
		}
	});
	that.btn_prev.bind({
		click : function(){
			if(!that.animateing){
				that.animateing = true;
				that.curIdx--;
				that.scrollTo(that.curIdx);
			}
		}
	});
}
album_scroll.prototype = {
	btnShow : function(){
		var that = this;
		if(that.len <= that.area){
			that.btn_prev.css({"display":"none"});
			that.btn_next.css({"display":"none"});
		}
		else{
			if(that.curIdx == 0){
				that.btn_prev.css({"display":"none"});
				that.btn_next.css({"display":"block"});
			}
			else if(that.curIdx == (that.len - that.area)){
				that.btn_prev.css({"display":"block"});
				that.btn_next.css({"display":"none"});
			}
			else{
				that.btn_prev.css({"display":"block"});
				that.btn_next.css({"display":"block"});
			}
		}
	},
	scrollTo : function(cur){
		var that = this;
		that.btnShow();
		that.list.animate({
			"left": (-1) * that.step * that.curIdx
		},400,function(){
			that.animateing = false;
		});
	}
}
function album_pop(option){
	var that = this;
	that.obj = $(option.obj);
	that.btn_prev = that.obj.find(option.btn_prev);
	that.btn_next = that.obj.find(option.btn_next);
	that.img = that.obj.find(option.album_img);
	that.page_num = that.obj.find(option.page_num);
	that.page_cur = that.obj.find(option.page_cur);
	that.btn_close = that.obj.find(option.btn_close);
	that.mask = $(option.mask);
	that.len = option.len;
	that.curIdx = 1;
	function init(){
		that.btnShow();
		that.setPage(that.curIdx);
	}
	init();
	that.btn_next.bind({
		click : function(){
				that.curIdx++;
				that.switchTo(that.curIdx);
			}
	});
	that.btn_prev.bind({
		click : function(){
			that.curIdx--;
			that.switchTo(that.curIdx);
		}
	});
	that.btn_close.bind({
		click : function(){
			that.popHide();
		}
	});
}
album_pop.prototype = {
	btnShow : function(){
		var that = this;
		if(that.curIdx == 0){
			that.btn_prev.css({"display":"none"});
			that.btn_next.css({"display":"block"});
		}
		else if(that.curIdx == that.len - 1){
			that.btn_prev.css({"display":"block"});
			that.btn_next.css({"display":"none"});
		}
		else{
			that.btn_prev.css({"display":"block"});
			that.btn_next.css({"display":"block"});
		}
	},
	setPage : function(cur){
		var that = this;
		cur++;
		that.page_cur.html(cur);
		that.page_num.html(that.len);
	},
	popShow : function(cur){
		var that = this;
		that.mask.css({"display":"block"});
		that.obj.css({"display":"block"});
		that.switchTo(cur);
	},
	switchTo : function(cur){
		var that = this;
		that.curIdx = cur;
		that.btnShow();
		that.setPage(that.curIdx);
		that.img.hide().eq(that.curIdx).show();
	},
	popHide : function(){
		var that = this;
		that.mask.css({"display":"none"});
		that.obj.css({"display":"none"});
	}
}